import 'package:liuxlcommon/view/extension_widget.dart';
import 'package:ladder_cash/app/com/service/burial_point_service.dart';
import 'package:ladder_cash/app/page/component/common.dart';
import 'package:ladder_cash/generated/l10n.dart';
import 'package:ladder_cash/value/app_colors.dart';
import 'package:ladder_cash/value/app_lstyle.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:liuxlcommon/view/loading_view.dart';
import 'package:liuxlcommon/view/lxl_widget.dart';
import 'package:liuxlcommon/view/my_style.dart';

import '../../../Global.dart';
import '../../../library/src/logger.dart';
import '../../comm_key_def.dart';
import 'authentication_logic.dart';

///工作信息
class JobInformationPage extends StatefulWidget {
  JobInformationPage({super.key});

  @override
  _AuthenticationPageState createState() => _AuthenticationPageState();
}

class _AuthenticationPageState extends State<JobInformationPage> {
  final logic = Get.find<AuthenticationLogic>();

  @override
  void initState() {
    super.initState();
    BurialPointService.start(BPoint.job);
    Logger.d("JobInformationPage");
  }

  @override
  Widget build(BuildContext context) {
    return LoadingView(
        isPullDown: true,
        future: () => logic.getJobInfo(),
        datas: logic.authenticationInfo,
        onSuccess: () {
          if (logic.authenticationInfo != null) logic.update();
        },
        body: () => Column(
          children: [
            getTitleTop(),
            Expanded(
              child: Container(
                  padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 20.w),
                  width: Global.width,
                  decoration: const BoxDecoration(
                    color: Colors.white,
                      borderRadius: BorderRadius.only(
                          topLeft: Radius.circular(8), topRight: Radius.circular(8))),
                  child: LFlexV([logic.chooseList(type:  CommKeyDef.job), confirmBtn])),
            ),
          ],
        ),
    );
  }

  get confirmBtn => Column(children: [
    LSizeBoxHeight(16.w),
    Container(
      height: 53.w,
      padding: EdgeInsets.symmetric(horizontal:  16.w),
      child: commonBtn(S.current.next, callback: () {
        logic.saveJopInfo();
      }),
    ),
    LSizeBoxHeight(42.w)
  ]);
}
